home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE23
/
SYSFONT
/
F_FONT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-03-22
|
2KB
|
107 lines
unit F_Font;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, SysFont;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
Button1Click(Self);
end;
procedure SetSysFont(ALabel: TLabel; AFont: TSysFont);
var
TempFont: TFont;
strStyle: string[12];
strCaption: string;
begin
TempFont := TFont.Create;
try
GetSysFont(AFont, TempFont);
ALabel.Font := TempFont;
Case AFont of
sfCaptionFont:
strCaption := 'Title Bar Caption Font = ';
sfSmCaptionFont:
strCaption := 'Small Title Bar Caption Font = ';
sfMenuFont:
strCaption := 'Menu & Selected Items Font = ';
sfStatusFont:
strCaption := 'ToolTip Font = ';
sfMessageFont:
strCaption := 'Message Box Font = ';
sfIconFont:
strCaption := 'Icon Font = ';
end;
strStyle := '';
If fsBold in TempFont.Style then
strStyle := 'Bold';
If fsItalic in TempFont.Style then
strStyle := strStyle + 'Italic';
strCaption := strCaption +
TempFont.Name + ', ' + IntToStr(TempFont.Size) + 'pt.';
If strStyle <> EmptyStr then
strCaption := strCaption + ', ' + strStyle;
ALabel.Caption := strCaption;
finally
TempFont.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SetSysFont(Label1, sfCaptionFont);
SetSysFont(Label2, sfSmCaptionFont);
SetSysFont(Label3, sfMenuFont);
SetSysFont(Label4, sfStatusFont);
SetSysFont(Label5, sfMessageFont);
SetSysFont(Label6, sfIconFont);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
end.